package cn.darkhorse.device.dto;

import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDate;
import java.time.LocalDateTime;

@Data
public class MesReportDTO {
    Long[] deviceIds;
    Integer type;
    Integer dateType;
    String year;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    LocalDateTime beginDate;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    LocalDateTime endDate;
    String yearMonth;
    Long deviceType;
    Long deviceId;
    Long dept;
    String deviceName;
    String deviceCode;
    Integer maintenanceLevel;

    public void setBeginDate(LocalDate date) {
        this.beginDate = date != null ? date.atStartOfDay() : null;
    }

    public void setEndDate(LocalDate date) {
        this.endDate = date != null ? date.atStartOfDay().plusDays(1).minusSeconds(1) : null;
    }
}
